#include "test_googlereader.hpp"
/****************************************************
*       System dependencies
****************************************************/
#include <sstream>
#include <iostream>

#include <cppunit/TestCaller.h>

/****************************************************
*       SocialBox dependencies
****************************************************/
#include "libsocialbox/google_reader.hpp"
#include "libsocialbox/web_client.hpp"
 
/****************************************************
*       Namespaces
****************************************************/
using namespace Poco;
using namespace std;
using namespace CppUnit;

void GoogleReaderTest::setUp() {
    gr = new GoogleReader(WebClient::Synchronous);
}

void GoogleReaderTest::tearDown() {
    delete gr;
}

void GoogleReaderTest::testLogin()
{   
    int status;
    status = gr->login("test.socialbox", "S0ci@lB0x");
    cout << "GoogleReader login returned: " << status << endl;
    CPPUNIT_ASSERT(status == 0);
    status = gr->login("test.socialbox", "passwordquimarchepas");
    cout << "GoogleReader login returned: " << status << endl;
    CPPUNIT_ASSERT(status == -1);
}

CppUnit::Test* GoogleReaderTest::suite() {
    TestSuite *pSuite = new TestSuite("GoogleReader");
    pSuite->addTest( new CppUnit::TestCaller<GoogleReaderTest> ("testLogin", &GoogleReaderTest::testLogin));
    return pSuite;
}
